﻿using agsXMPP.protocol.client;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Windows.Media;

namespace Mammoth.Entities
{
    public enum AccountState
    {
        Logoff, Login, Busy
    }

    public class AccountEntity : Entity, IGtalkEntity
    {
        public AccountEntity() : base() { }

        public AccountEntity(string serviceEmail)
            : base()
        {
            Email = serviceEmail;
            PresenceType = PresenceType.available;
            State = AccountState.Logoff;
            IsAutoLogin = true;
        }

        public bool IsAutoLogin { get; set; }
        [Required(ErrorMessage = "Email tidak boleh kosong")]
        [StringLength(256, ErrorMessage = "Email tidak boleh lebih dari 256 karakter")]
        public string Email { get; set; }
        [Required(ErrorMessage = "Password tidak boleh kosong")]
        [StringLength(64, ErrorMessage = "Password tidak boleh lebih dari 64 karakter")]
        public string Password { get; set; }

        [NotMapped]
        public string Name { get; set; }
        [NotMapped]
        public AccountState State { get; set; }
        [NotMapped]
        public PresenceType PresenceType { get; set; }
        [NotMapped]
        public ImageSource Avatar { get; set; }
        [NotMapped]
        public string Status { get; set; }

        public IList<OutboxEntity> Outbox { get; set; }
        public IList<InboxEntity> Inbox { get; set; }
    }
}
